//
//  MeatMeOrderTableViewCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/3.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "MeatMeOrderTableViewCell.h"
#import "MeatMeItem.h"


@interface MeatMeOrderTableViewCell()


@end


@implementation MeatMeOrderTableViewCell

#pragma mark - lifecycle methods

- (void)setupUI
{
    [self addSubview:self.payItem];
    [self addSubview:self.acceptItem];
    [self addSubview:self.evaluationItem];
    [self addSubview:self.serviceItem];

}

- (void)setupLayout
{
    {
        _payItem.mj_x = 0;
        _acceptItem.mj_x = _payItem.right;
        _evaluationItem.mj_x = _acceptItem.right;
        _serviceItem.mj_x = _evaluationItem.right;
    }
}

#pragma mark - setter methods


#pragma mark - getter methods

- (MeatMeItem *)payItem{
    
    if (!_payItem) {
        _payItem = [[MeatMeItem alloc] init];
        _payItem.icon.image = [UIImage imageNamed:@"order_waitpay"];
        _payItem.nameLab.text = @"待付款";
        _payItem.type = MeatMeItemType_Order;
        
        @weakify(self);
        _payItem.isNeedAnimation = YES;
        _payItem.tapBlock = ^{
            @strongify(self);
            if (self.dealPayBlock) {
                self.dealPayBlock();
            }
        };
    }
    return _payItem;
}

- (MeatMeItem *)acceptItem{
    
    if (!_acceptItem) {
        _acceptItem = [[MeatMeItem alloc] init];
        _acceptItem.icon.image = [UIImage imageNamed:@"order_waittake"];
        _acceptItem.nameLab.text = @"待收货";
        _acceptItem.type = MeatMeItemType_Order;
        
        @weakify(self);
        _acceptItem.isNeedAnimation = YES;
        _acceptItem.tapBlock = ^{
            @strongify(self);
            if (self.dealAcceptBlock) {
                self.dealAcceptBlock();
            }
        };

    }
    return _acceptItem;
}


- (MeatMeItem *)evaluationItem{
    
    if (!_evaluationItem) {
        _evaluationItem = [[MeatMeItem alloc] init];
        _evaluationItem.icon.image = [UIImage imageNamed:@"order_waitevaluate"];
        _evaluationItem.nameLab.text = @"待评价";
        _evaluationItem.type = MeatMeItemType_Order;
        
        @weakify(self);
        _evaluationItem.isNeedAnimation = YES;
        _evaluationItem.tapBlock = ^{
            @strongify(self);
            if (self.dealEvaluationBlock) {
                self.dealEvaluationBlock();
            }
        };

    }
    return _evaluationItem;
}


- (MeatMeItem *)serviceItem{
    
    if (!_serviceItem) {
        _serviceItem = [[MeatMeItem alloc] init];
        _serviceItem.icon.image = [UIImage imageNamed:@"order_refund"];
        _serviceItem.nameLab.text = @"售后";
        _serviceItem.type = MeatMeItemType_Order;

        @weakify(self);
        _serviceItem.isNeedAnimation = YES;
        _serviceItem.tapBlock = ^{
            @strongify(self);
            if (self.dealServiceBlock) {
                self.dealServiceBlock();
            }
        };
    }
    return _serviceItem;
}



@end
